{% extends "base.html" %}
{% block content %}
<h2>任务详情</h2>
<div id="task-detail"></div>
<div id="task-download-files" class="mt-3"></div>
<script>
fetch('/api/task/{{ task_id }}').then(r=>r.json()).then(data=>{
  let html = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
  document.getElementById('task-detail').innerHTML = html;
  // 下载链接展示
  if (data.download_files && data.download_files.length > 0) {
    let links = data.download_files.map(f => `<a href="${f.download_url}" class="btn btn-success btn-sm me-2" target="_blank">下载: ${f.file_name}</a>`).join('');
    document.getElementById('task-download-files').innerHTML = `<h4>可下载文件：</h4>${links}`;
  }
});
</script>
{% endblock %} 